<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-wrap align-center justify-between benben-position-layout flex addShop_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center addShop_fd0_0' @tap.stop="handleJumpDiy" data-type="back"
					data-url="1">
					<image class='addShop_fd0_0_c0' mode="aspectFit" :src='STATIC_URL+"94.png"'></image>
				</view>
				<text class='addShop_fd0_1'>店铺信息</text>
				<view class='flex flex-wrap align-center addShop_fd0_0'>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-center justify-center benben-flex-layout addShop_flex_1"
				v-if=" shopData.examine=='3'">
				<text class='addShop_fd1_0'>审核失败，提供的信息有误</text>
				<view>
					<text class='addShop_fd1_0'>失败原因：</text>
					<text class='addShop_fd1_0'>{{shopData.readon}}</text>
				</view>
			</view>

			<!---flex布局flex布局结束-->
			<!---店铺信息flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout addShop_flex_2">
				<view class='flex align-center self-center justify-between addShop_fd2_0'>
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_0_c1'>店铺名称</text>
					<benben-input class='flex-sub addShop_fd2_0_c2' type="text" :placeholder="`请输入店铺名称`"
						confirm-type="done" :maxlength="-1"
						placeholder-style="color:rgba(187, 187, 187, 1);font-size:32rpx"
						v-model="shopData.store_name" />
				</view>
				<view class='flex align-center addShop_fd2_1'>
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_1_c1'>店铺logo</text>
					<text class='addShop_fd2_1_c2'>(72*72)</text>
					<view class='flex flex-wrap align-center'>
						<view class="upload position-relative">
							<image class=" addShop_fd2_1_c3_c0_image" mode="aspectFill"
								@tap="soloChooseImage('store_logo','store_logo',shopData,shopData)"
								:src="shopData.store_logo ? shopData.store_logo : STATIC_URL+'91.png'"></image>
						</view>
					</view>
				</view>
				<view class='flex flex-wrap align-center addShop_fd2_2'>
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_1_c1'>店铺背景</text>
					<text class='addShop_fd2_1_c2'>(375*135)</text>
				</view>
				<view class='flex flex-wrap align-center addShop_fd2_3'>
					<benben-images-upload ref="benbenImagesUploadfd2_3_c0" :img-list.sync="store_backdropImage"
						:img-ids.sync="shopData.store_backdrop" :maxlength="9">
						<template #content="{ num, maxlength, isShow, imgList }">
							<view class="flex flex-wrap align-start flex">

								<view v-for="(image, index) in imgList" :key="index"
									class='flex position-relative addShop_fd2_3_c00'>
									<text class='fu-iconfont2 position-absolute addShop_fd2_3_c000'
										@tap.stop="$refs.benbenImagesUploadfd2_3_c0.delImage(index)">&#xE8E7;</text>
									<image class='addShop_fd2_1_c3_c0_image'
										@tap.stop="$refs.benbenImagesUploadfd2_3_c0.previewImage(index)"
										mode="aspectFill" :src='image'></image>
								</view>
								<image class='addShop_fd2_3_c01'
									@tap.stop="$refs.benbenImagesUploadfd2_3_c0.manyChooseImage()" v-if="isShow"
									mode="aspectFill" :src='STATIC_URL+"97.png"'></image>

							</view>
						</template>
					</benben-images-upload>
				</view>
				<!-- 		<view class='flex align-center addShop_fd2_0'>
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_1_c1'>营业执照</text>
					<view class='flex flex-wrap align-center addShop_fd2_4_c2'>
						<view class="upload position-relative addShop_fd2_4_c2">

							<image class=" addShop_fd2_1_c3_c0_image" mode="aspectFill"
								@tap="gochooseImages('business_licence','business_licence',shopData,shopData)"
								:src="shopData.business_licence ? shopData.business_licence : STATIC_URL+'91.png'">
							</image>
						</view>
					</view>
				</view> -->
				<view class='flex align-center justify-between addShop_fd2_0' @tap.stop="pickerDiy1680491677140=true">
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_5_c1'>店铺所在地</text>
					<benben-input class='addShop_fd2_5_c2' type="text" :placeholder="`请选择`" confirm-type="done"
						:maxlength="-1" :disabled='true'
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="shopData.location" />
					<image class='addShop_fd2_5_c3' mode="aspectFit" :src='STATIC_URL+"99.png"'></image>
				</view>
				<view class='flex flex-direction align-stretch justify-between addShop_fd2_0'>
					<view class='flex align-center self-center addShop_fd2_6_c0'>
						<text class='self-center addShop_fd2_0_c0'>*</text>
						<text class='addShop_fd2_1_c1'>店铺详细地址</text>
					</view>
					<view class='flex flex-wrap addShop_fd2_6_c1'>
						<textarea class='flex addShop_input_fd2_6_c1' confirm-type="done" :placeholder="'请输入详细地址'"
							:maxlength="240" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"
							v-model="shopData.store_address" />

					</view>
				</view>
				<view class='flex flex-direction align-stretch justify-between addShop_fd2_0'>
					<view class='flex align-center self-center addShop_fd2_6_c0'>
						<text class='self-center addShop_fd2_0_c0'>*</text>
						<text class='addShop_fd2_1_c1'>店铺简介</text>
					</view>
					<view class='flex flex-wrap addShop_fd2_6_c1'>
						<textarea class='flex addShop_input_fd2_6_c1' confirm-type="done" :placeholder="'请输入店铺简介'"
							:maxlength="240" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"
							v-model="shopData.store_introduce" />

					</view>
				</view>
				<view class='flex align-center addShop_fd2_0'>
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_5_c1'>营业时间</text>
					<view class='flex flex-wrap align-center' @tap.stop="pickerDiy1686275199453=true">
						<benben-input class='addShop_fd2_8_c2_c0' type="text" :placeholder="`开始时间`" confirm-type="done"
							:maxlength="-1" :disabled='true'
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"
							v-model="shopData.business_hours" />
					</view>
					<text class='addShop_fd2_8_c3'>至</text>
					<view class='flex flex-wrap align-center' @tap.stop="pickerDiy1686275172501=true">
						<benben-input class='addShop_fd2_8_c4_c0' type="text" :placeholder="`结束时间`" confirm-type="done"
							:maxlength="-1" :disabled='true'
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"
							v-model="shopData.end_time" />
					</view>
				</view>
				<view class='flex align-center justify-between addShop_fd2_0'>
					<text class='self-center addShop_fd2_0_c0'>*</text>
					<text class='addShop_fd2_1_c1'>客服电话</text>
					<benben-input class='flex-sub addShop_fd2_0_c2' type="number" :placeholder="`请输入客服电话`"
						confirm-type="done" :maxlength="11"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"
						v-model="shopData.service_phone" />
				</view>
			</view>

			<!---店铺信息flex布局结束-->
			<!--结束时间选择器开始 -->
			<benben-picker ref="benbenWritePickerCodepicker3" :visible.sync="pickerDiy1686275172501"
				:value.sync='shopData.end_time' mode='time' :mask-show='true' :timeout='true' :picker-height='88'
				:current='true' :second='false'>
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between addShop_picker3_0'>
						<text class='addShop_picker3_0_c0' @tap="$refs.benbenWritePickerCodepicker3.cancel()">取消</text>
						<text class='addShop_picker3_0_c1'>请选择结束时间</text>
						<text class='addShop_picker3_0_c2'
							@tap="$refs.benbenWritePickerCodepicker3.pickerConfirm()">确认</text>
					</view>
				</template>
			</benben-picker>
			<!--结束时间选择器结束 -->
			<!--开始时间选择器开始 -->
			<benben-picker ref="benbenWritePickerCodepicker4" :visible.sync="pickerDiy1686275199453"
				:value.sync='shopData.business_hours' mode='time' :mask-show='true' :timeout='true' :picker-height='88'
				:current='true' :second='false'>
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between addShop_picker4_0'>
						<text class='addShop_picker4_0_c0' @tap="$refs.benbenWritePickerCodepicker4.cancel()">取消</text>
						<text class='addShop_picker4_0_c1'>请选择开始时间</text>
						<text class='addShop_picker4_0_c2'
							@tap="$refs.benbenWritePickerCodepicker4.pickerConfirm()">确认</text>
					</view>
				</template>
			</benben-picker>
			<!--开始时间选择器结束 -->
			<!--店铺所在地选择器开始 -->
			<benben-picker ref="benbenWritePickerCodepicker5" :visible.sync="pickerDiy1680491677140"
				:label.sync='shopData.location' mode='region' :mask-show='true' :picker-height='88' :hide-area='false'>
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between addShop_picker5_0'>
						<text class='addShop_picker5_0_c0' @tap="$refs.benbenWritePickerCodepicker5.cancel()">取消</text>
						<text class='addShop_picker5_0_c1'>选择地址</text>
						<text class='addShop_picker5_0_c2'
							@tap="$refs.benbenWritePickerCodepicker5.pickerConfirm()">确定</text>
					</view>
				</template>
			</benben-picker>
			<!--店铺所在地选择器结束 -->
			<view class="flex align-center justify-center benben-position-layout flex addShop_flex_6">
				<button class='addShop_fd6_0' @tap.stop="submitMessageFunc()">提交</button>

			</view>
			<view :style="{height: '160rpx'}"></view>


		</view>
	</view>
</template>
<script>
	import UploadImage from '@/common/utils/upload-image.js'
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"pickerDiy1680491677140": false,
				"pickerDiy1686275199453": false,
				"pickerDiy1686275172501": false,
				"shopData": {
					"aid": "",
					"store_name": "",
					"store_logo": "",
					"store_address": "",
					"business_licence": "",
					"contacts_name": "",
					"contacts_phone": "",
					"store_backdrop": [],
					"service_phone": "",
					"business_hours": "",
					"store_introduce": "",
					"store_star": "",
					"store_collection_num": "",
					"certification_status": "",
					"store_status": "",
					"is_collection": "",
					"mobile": "",
					"expiration_time": "",
					"location": "",
					"store_backdrop_many": [],
					"end_time": "",
					"score": "",
					"examine": "",
					"readon": "",
					"account_wx": "",
					"account_alipay": "",
					"account_bank": "",
					"withdraw_handling_fee": "",
					"user_money": ""
				},
				"store_backdropImage": [],
				"id": "",
				"shopID": ""
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			userInfo: {
				get() {
					return this.$store.state.userInfo
				},
				set() {
					this.$store.commit('updateUserInfo', value)
				},
			},
			/**
			 * @returns 
			 * Android       安卓
			 * IOS       苹果
			 * Web       H5 或 pc
			 * Wechat       微信小程序
			 * Alipay       支付宝小程序
			 * Baidu       百度小程序
			 * ByteBounce       抖音小程序
			 * 360       360小程序
			 * FastApp       快应用
			 */
			appSystemIdentification() {
				return this.$store.state.appSystemIdentification
			}
		},
		watch: {},
		onLoad(options) {
			let {
				id,
				shopID
			} = options
			if (id !== undefined) this.id = id
			if (shopID !== undefined) this.shopID = shopID
			this.getShopDetailsFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//上传单图、多图方法
			soloChooseImage(id, path, obj, obj1, fnName = false) {
				if (!this.setCheckPermission(2)) {
					return
				}
				let self = this
				if (!obj) obj = this
				if (!obj1) obj1 = this
				if (self.uploading) {
					return
				}
				// 从相册中选择图片
				uni.chooseImage({
					count: 1, // 默认3
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					success: function(res) {
						self.uploading = true
						// 开始上传
						new UploadImage(res.tempFiles, {
							complete: function(res) {
								self.uploading = false
								if (id) self.$set(obj, id, res[0].id)
								if (path) self.$set(obj1, path, res[0].path)
								if (fnName) self[fnName]()
							},
						})
					},
				})
			},
			//提交店铺信息
			async submitMessageFunc() {
				if (!validate(this.shopData.store_name, 'require')) {
					this.$message.info('店铺名称不能为空');
					return false;
				}
				if (!validate(this.shopData.store_logo, 'require')) {
					this.$message.info('店铺logo不能为空');
					return false;
				}
				if (!validate(this.shopData.store_backdrop, 'require')) {
					this.$message.info('店铺背景不能为空');
					return false;
				}
				// if (!validate(this.shopData.business_licence, 'require')) {
				// 	this.$message.info('营业执照不能为空');
				// 	return false;
				// }
				if (!validate(this.shopData.location, 'require')) {
					this.$message.info('店铺所在地不能为空');
					return false;
				}
				if (!validate(this.shopData.store_address, 'require')) {
					this.$message.info('店铺详细地址不能为空');
					return false;
				}
				if (!validate(this.shopData.store_introduce, 'require')) {
					this.$message.info('店铺简介不能为空');
					return false;
				}
				if (!validate(this.shopData.business_hours, 'require')) {
					this.$message.info('营业开始时间不能为空');
					return false;
				}
				if (!validate(this.shopData.end_time, 'require')) {
					this.$message.info('营业结束时间不能为空');
					return false;
				}
				if (!validate(this.shopData.service_phone, 'require')) {
					this.$message.info('客服电话不能为空');
					return false;
				}
				//请求方法
				//数据验证

				let data62bd977cbc707 = await this.$api.dbPost(global.apiUrls.post62bd977cbc707, {
					store_name: this.shopData.store_name,
					store_logo: this.shopData.store_logo,
					store_address: this.shopData.store_address,
					store_backdrop: this.shopData.store_backdrop,
					store_introduce: this.shopData.store_introduce,
					service_phone: this.shopData.service_phone,
					business_hours: this.shopData.business_hours,
					location: this.shopData.location,
					aid: this.shopData.aid,
					end_time: this.shopData.end_time,
					business_licence: this.shopData.business_licence
				});
				if (!data62bd977cbc707) return
				if (data62bd977cbc707.data.code != 1) {
					this.$message.info(data62bd977cbc707.data.msg);
					return
				}
				this.$message.info('修改成功');
				setTimeout(() => {
					this.$urouter.switchTab(`/pages/tabBar/my/my`);
				}, 500)
			},
			//获取店铺信息
			async getShopDetailsFunc() {
				//请求方法
				//数据验证
				let datashopData = await this.$api.get(global.apiUrls.post641b0ae793987, {
					partner_id: this.id,
					user_id: this.userInfo.id
				});
				if (datashopData.data.code != 1) {
					this.$message.info(datashopData.data.msg);
					return
				}
				let infoshopData = datashopData.data;
				this.shopData = infoshopData.data

				this.store_backdropImage = this.shopData.store_backdrop
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.addShop_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.addShop_fd0_1 {
		color: #333333;
		font-size: 36rpx;
		font-weight: 500;
		line-height: 50rpx;
	}

	.addShop_fd0_0_c0 {
		width: 20rpx;
		height: 36rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 32rpx;
	}

	.addShop_fd0_0 {
		width: 100rpx;
		height: 88rpx;
	}

	.addShop_flex_1 {
		background: rgba(248, 209, 208, 1);
		background-size: 100% auto !important;
		padding: 24rpx 32rpx 24rpx 32rpx;
	}

	.addShop_fd1_0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(227, 29, 26, 1);
		line-height: 33rpx;
		margin: 0rpx 0rpx 16rpx 0rpx;
	}

	.addShop_flex_2 {
		background: #fff;
		background-size: 100% auto !important;
		padding: 0rpx 32rpx 0rpx 32rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.addShop_fd2_8_c4_c0 {
		width: 135rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		text-align: right;
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.addShop_fd2_8_c3 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.addShop_fd2_8_c2_c0 {
		width: 200rpx;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		text-align: right;
		margin: 0rpx 24rpx 0rpx 24rpx;
	}

	.addShop_input_fd2_6_c1 {
		width: 100%;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
		height: 160rpx;
	}

	.addShop_fd2_6_c1 {
		background: rgba(246, 247, 249, 1);
		width: 686rpx;
		background-size: 100% auto !important;
		padding: 24rpx 24rpx 24rpx 24rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.addShop_fd2_6_c0 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.addShop_fd2_5_c3 {
		width: 19rpx;
		height: 28rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.addShop_fd2_5_c2 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		text-align: right;
		margin: 0rpx 0rpx 0rpx 24rpx;
	}

	.addShop_fd2_5_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		line-height: 40rpx;
		margin: 0rpx auto 0rpx 0rpx;
	}

	.addShop_fd2_4_c2 {
		margin: 0rpx 0rpx 0rpx auto;
	}

	.addShop_fd2_3_c01 {
		width: 180rpx;
		height: 180rpx;
		margin: 0rpx 12rpx 32rpx 0rpx;
		border-radius: 16rpx;
	}

	.addShop_fd2_3_c000 {
		top: 0rpx;
		right: 0rpx;
		z-index: 9;
		color: #ff5536;
	}

	.addShop_fd2_3_c00 {
		margin: 0rpx 12rpx 32rpx 0rpx;
	}

	.addShop_fd2_3 {
		border-bottom: 1px solid #eee;
	}

	.addShop_fd2_2 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.addShop_fd2_1_c3_c0_image {
		width: 180rpx;
		height: 180rpx;
		border-radius: 16rpx;
	}

	.addShop_fd2_1_c2 {
		color: #929292;
		font-size: 26rpx;
		font-weight: 400;
		line-height: 37rpx;
		margin: 0rpx auto 0rpx 14rpx;
	}

	.addShop_fd2_1_c1 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		line-height: 40rpx;
	}

	.addShop_fd2_1 {
		border-bottom: 1px solid #eee;
		padding: 30rpx 0rpx 30rpx 0rpx;
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.addShop_fd2_0_c2 {
		margin: 0rpx 0rpx 0rpx 32rpx;
		text-align: right;
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.addShop_fd2_0_c1 {
		color: #2A2A2A;
		font-size: 32rpx;
		font-weight: 400;
		line-height: 42rpx;
	}

	.addShop_fd2_0_c0 {
		color: var(--benbenFontColor5);
	}

	.addShop_fd2_0 {
		border-bottom: 1px solid #eee;
		padding: 30rpx 0rpx 30rpx 0rpx;
	}

	.addShop_picker3_0_c2 {
		font-size: 32rpx;
		font-weight: 400;
		color: rgba(227, 29, 26, 1);
		line-height: 28rpx;
	}

	.addShop_picker3_0_c1 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		line-height: 45rpx;
	}

	.addShop_picker3_0_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		line-height: 40rpx;
	}

	.addShop_picker3_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		background-size: 100% auto !important;
		height: 110rpx;
	}

	.addShop_picker4_0_c2 {
		color: rgba(227, 29, 26, 1);
		font-size: 32rpx;
		font-weight: 400;
	}

	.addShop_picker4_0_c1 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
		line-height: 45rpx;
	}

	.addShop_picker4_0_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: #333;
	}

	.addShop_picker4_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		background-size: 100% auto !important;
		height: 110rpx;
	}

	.addShop_picker5_0_c2 {
		color: rgba(227, 29, 26, 1);
		font-size: 32rpx;
		font-weight: 400;
	}

	.addShop_picker5_0_c1 {
		font-size: 32rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
	}

	.addShop_picker5_0_c0 {
		font-size: 32rpx;
		font-weight: 400;
		color: rgba(153, 153, 153, 1);
	}

	.addShop_picker5_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		border-radius: 25rpx 25rpx 0rpx 0rpx;
		background-size: 100% auto !important;
		height: 110rpx;
	}

	.addShop_flex_6 {
		background: rgba(248, 248, 248, 1);
		width: 750rpx;
		height: 160rpx;
		overflow: hidden;
		z-index: 10;
		bottom: calc(0rpx + var(--window-bottom));
		background-size: 100% auto !important;
	}

	.addShop_fd6_0 {
		background: #E31D1A;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor3);
		width: 686rpx;
		height: 88rpx;
		line-height: 88rpx;
		font-weight: 500;
	}
</style>